<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <meta charset="utf-8"/>
    <title>视频规则</title>
    <meta name="description" content="overview & stats"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="static/css/bootstrap-responsive.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="static/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="static/css/ace.min.css"/>
    <link rel="stylesheet" href="static/css/ace-responsive.min.css"/>
    <link rel="stylesheet" href="static/css/ace-skins.min.css"/>
    <script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
    <!--提示框-->
    <script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>

<script type="text/javascript">
    $(function () {
        top.hangge();
    });

    //保存
    function save() {
        var reg = /^[0-9]+\*[0-9]+$/
        var watchDisplayResolution = $("#watchDisplayResolution").val();
        if (watchDisplayResolution == "") {
            $("#watchDisplayResolution").tips({
                side: 3,
                msg: '请输入设备端分辨率',
                bg: '#AE81FF',
                time: 2
            });
            $("#watchDisplayResolution").focus();
            return false;
        }
        if (!reg.test(watchDisplayResolution)) {
            $("#watchDisplayResolution").tips({
                side: 3,
                msg: '设备端分辨率不合法',
                bg: '#AE81FF',
                time: 2
            });
            $("#watchDisplayResolution").focus();
            return false;
        }
        var displayResolution = $("#displayResolution").val();
        if (displayResolution == "") {
            $("#displayResolution").tips({
                side: 3,
                msg: '请输入APP端分辨率',
                bg: '#AE81FF',
                time: 2
            });
            $("#displayResolution").focus();
            return false;
        }
        if (!reg.test(displayResolution)) {
            $("#displayResolution").tips({
                side: 3,
                msg: 'app端分辨率不合法',
                bg: '#AE81FF',
                time: 2
            });
            $("#displayResolution").focus();
            return false;
        }
        if ($("#oneCallTime").val() == "") {
            $("#oneCallTime").tips({
                side: 3,
                msg: '请输入单次通话时长(s)',
                bg: '#AE81FF',
                time: 2
            });
            $("#oneCallTime").focus();
            return false;
        }
        if ($("#callInterval").val() == "") {
            $("#callInterval").tips({
                side: 3,
                msg: '请输入通话间隔(s)',
                bg: '#AE81FF',
                time: 2
            });
            $("#callInterval").focus();
            return false;
        }
        if ($("#allCallTime").val() == "") {
            $("#allCallTime").tips({
                side: 3,
                msg: '请输入总视频时长(s)',
                bg: '#AE81FF',
                time: 2
            });
            $("#allCallTime").focus();
            return false;
        }

        $("#menuForm").submit();
        $("#zhongxin").hide();
        $("#zhongxin2").show();

    }

</script>

<body>
<form action="videoModel/edit" name="menuForm" id="menuForm" method="post">
    <input type="hidden" name="id" id="id" value="${video.id}"/>
    <div id="zhongxin" class="zhongxin-cla">
        <table>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>视频规则名称：</span>
                    <input type="text" name="name" id="name" placeholder="视频规则名称" value="${video.name}" readonly/>
                </td>
            </tr>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>设备端分辨率：</span>
                    <input type="text" name="watchDisplayResolution" id="watchDisplayResolution"
                           value="${video.watchDisplayResolution}" placeholder="宽*高 eg:120*160"/>
                </td>
            </tr>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>APP端分辨率：</span>
                    <input type="text" name="displayResolution" id="displayResolution" placeholder="宽*高 eg:120*160"
                           value="${video.displayResolution}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>单次通话时长(s)：</span>
                    <input type="number" name="oneCallTime" id="oneCallTime" value="${video.oneCallTime}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>通话间隔(s)：</span>
                    <input type="number" name="callInterval" id="callInterval" value="${video.callInterval}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>总视频时长(s)：</span>
                    <input type="number" name="allCallTime" id="allCallTime" value="${video.allCallTime}"/>
                </td>
            </tr>
            <tr>
                <td>
                    <span>备注：</span>
                    <textarea name="desNote" id="desNote" placeholder="视频规则备注" rows="3">${video.desNote}</textarea>
                </td>
            </tr>
            <tr>
                <td style="text-align: center; padding-top: 10px;">
                    <a class="btn btn-mini btn-primary" onclick="save();">保存</a>
                    <a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
                </td>
            </tr>
        </table>
    </div>
    <div id="zhongxin2" class="center" style="display:none">
        <br/><br/><br/><img src="static/images/jiazai.gif"/><br/>
        <h4 class="lighter block green"></h4>
    </div>
</form>
</body>
</html>